package com.googlecode.connectlet.crypto.stream;

import com.googlecode.connectlet.crypto.cipher.Encipheror;

public class OfbCipher extends FeedbackCipher {
	private static final long serialVersionUID = 1L;

	public OfbCipher(Encipheror cipher, byte[] iv) {
		super(cipher, iv);
	}

	@Override
	public int output() {
		int b = block[blockOffset];
		blockOffset ++;
		if (blockOffset == blockSize) {
			blockOffset = 0;
			cipher.encrypt(block, 0, block, 0);
		}
		return b;
	}
}